package week_home_work02;

import java.util.Scanner;

/**
 * @author zdl
 * @date 2024/11/23
 */
public class Demo85 {
    public static void main(String[] args) {
        //判断一个数字是否是 Armstrong 数。    (1^3 + 5^3 + 3^3 = 153)
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个整数:");
        int num = sc.nextInt();
        int yuanNum = num;
        int sum = 0;
        while (num != 0){
            int lastNum = num % 10;
            //System.out.println(lastNum);
            sum = sum + lastNum*lastNum*lastNum;
            num /= 10;
        }
        if (sum == yuanNum){
            System.out.println(yuanNum+"是一个 Armstrong 数");
        }else {
            System.out.println(yuanNum+"不是一个 Armstrong 数");
        }
    }
}
